﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace QFramework.Monk
{
    public class CoinUpSystem:AbstractSystem
    {
        public List<CoinUpItem> coinUpItems = new  List<CoinUpItem>();

        private ConfigModel configModel;
        protected override void OnInit()
        {
            configModel= this.GetModel<ConfigModel>();
            coinUpItems.Add(new CoinUpItem().WithAbilityType(AbilityType.Coin)
                .WithUpgradeAction((item) =>
                {
                    if(item.mAbilityConfig.Price>AppStart.goldNum.Value) return;
                    configModel.UpAbility(AppStart.coinDropLv.Value,AbilityType.Coin);
                }));
            coinUpItems.Add(new CoinUpItem().WithAbilityType(AbilityType.Exp)
                .WithUpgradeAction((item) =>
                {
                    if(item.mAbilityConfig.Price>AppStart.goldNum.Value) return;
                    configModel.UpAbility(AppStart.expDropLv.Value,AbilityType.Exp);
                }));
            coinUpItems.Add(new CoinUpItem().WithAbilityType(AbilityType.MaxHp)
                .WithUpgradeAction((item) =>
                {
                    if(item.mAbilityConfig.Price>AppStart.goldNum.Value) return;
                    configModel.UpAbility(AppStart.hpLv.Value,AbilityType.MaxHp);
                }));
            coinUpItems.Add(new CoinUpItem().WithAbilityType(AbilityType.Attack)
                .WithUpgradeAction((item) =>
                {
                    if(item.mAbilityConfig.Price>AppStart.goldNum.Value) return;
                    configModel.UpAbility(AppStart.attackLv.Value,AbilityType.Attack);
                }));
        }
    }
}